<template>
	<view class="content-box-big">
		<view class="content-box" v-if="!nengliangTF">
			<text >{{content}}</text>
		</view>
		<view class="power-tip" v-if="nengliangTF">
			<view class="power-title">能量是什么?</view>
			<view class="power-p" style="margin-bottom: 25px;">能量可用于A创作，每次对您的问题的回复都会消耗您的能量。</view>
			<view class="power-p" >您可以通过完成以下任务获得能量奖励:</view>
			<uni-table border stripe emptyText="暂无更多数据" >
				<!-- 表格数据行 -->
				<uni-tr>
					<uni-td>观看视频</uni-td>
					<uni-td>+{{video_rewards}}</uni-td>
				</uni-tr>
				<uni-tr>
					<uni-td>每日签到</uni-td>
					<uni-td>+{{everyday_sign}}</uni-td>
				</uni-tr>
				<uni-tr>
					<uni-td>邀请好友完成注册</uni-td>
					<uni-td>+{{invite_friends}}</uni-td>
				</uni-tr>
			</uni-table>
			<view class="power-p" style="margin-top: 25px;" >能量消耗说明:</view>
			<uni-table border stripe emptyText="暂无更多数据" >
				<!-- 表格数据行 -->
				<uni-tr>
					<uni-td>AI文字对话</uni-td>
					<uni-td>-{{text_dialog_consume}}</uni-td>
				</uni-tr>
				<uni-tr>
					<uni-td>AI绘画对话</uni-td>
					<uni-td>-{{painting_dialog_consume}}</uni-td>
				</uni-tr>
			</uni-table>
		</view>
	</view>
</template>

<script>
	import http from '../../api/api-index.js'
	
	export default{
		data(){
			return{
				content:'',
				title:'',
				nengliangTF:false,
				everyday_sign:0,//每日签到
				invite_friends:0,//邀请好友
				video_rewards:0,//激励广告
				text_dialog_consume:0,//文字消耗
				painting_dialog_consume:0,//绘画消耗
			}
		},
		onLoad(options) {
			this.title = options.name 
			uni.setNavigationBarTitle({
				title: options.name
			});
			if(options.name == '能量说明'){
				this.nengliangTF = true
				this.getPowerFun()
				return false
			}
			this.getXieyi()
			
		},
		methods:{
			getXieyi(){
				if(this.title == '用户协议'){
					http.getUserAgreement().then((res)=>{
						if(res.data.code == 200){
							this.content = res.data.data.content
						}
					})
				}else if(this.title == '用户信息保护政策'){
					http.getUserPrivacy().then((res)=>{
						if(res.data.code == 200){
							this.content = res.data.data.content
						}
					})
				}else if(this.title == '企业介绍'){
					http.getLtdIntroduce().then((res)=>{
						if(res.data.code == 200){
							this.content = res.data.data.content
						}
					})
				}
				
			},
			getPowerFun(){
				http.getUserPower().then((res)=>{
					console.log(res)
					if(res.data.code == 200){
						let data = res.data.result
						this.everyday_sign = data.everyday_sign
						this.invite_friends = data.invite_friends
						this.video_rewards = data.video_rewards
						this.text_dialog_consume = data.text_dialog_consume
						this.painting_dialog_consume = data.painting_dialog_consume
					}
				})
			},
		}
	}
</script>

<style scoped lang="scss">
	.content-box-big{
		background: $bg-color;
		width: 100%;
		min-height: 100vh;
		box-sizing: border-box;
		padding: 11px;
		.content-box{
			width: 100%;
			border-radius: 10px;
			background-color: #fff;
			text-indent: 2em;
			box-sizing: border-box;
			padding: 15px;
			font-size: 16px;
			line-height: 20px;
			text{
				text-indent: 2em;
			}
		}
		.power-tip{
			width: 100%;
			border-radius: 10px;
			background-color: #fff;
			box-sizing: border-box;
			padding: 15px;
			font-size: 16px;
			line-height: 20px;
			.power-title{
				font-size: 16px;
				margin-bottom: 10px;
			}
			.power-p{
				font-size: 14px;
				margin-bottom: 5px;
			}
		}
	}
	
	
</style>